#pragma once
#include <Windows.h>

class CCriticalSection
{
public:
    CCriticalSection()
    {
        InitializeCriticalSection(&m_cSection);
    }

    void Lock()
    {
        EnterCriticalSection(&m_cSection);
    }

    void UnLock()
    {
        LeaveCriticalSection(&m_cSection);
    }

    virtual ~CCriticalSection()
    {
        DeleteCriticalSection(&m_cSection);
    }
private:
    CRITICAL_SECTION    m_cSection;
};